home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / fonts / uspsbc.zip / USPSBC.MWM < prev    next >
Text File  |  1994-04-14  |  2KB  |  56 lines

  1. Sub MAIN
  2.  
  3. Begin Dialog UserDialog 490, 136, "Postal Barcode Entry"
  4.     Text 10, 2, 469, 13, "Enter the Information Required to Generate a Postal Bar Code", .Text2
  5.     Text 130, 24, 124, 13, "5 Digit Zip Code", .Text1
  6.     TextBox 273, 19, 53, 18, .zipcode
  7.     Text 155, 45, 99, 13, "Zip + 4 Code", .Text3
  8.     TextBox 273, 41, 46, 18, .zip4
  9.     Text 97, 69, 159, 13, "Postal Delivery Point", .Text4
  10.     TextBox 273, 64, 28, 18, .deliverypoint
  11.     Text 12, 89, 465, 13, "Delivery Point is normally the last two digits of House Number", .Text5
  12.     OKButton 103, 110, 88, 21
  13.     CancelButton 283, 110, 88, 21
  14. End Dialog
  15.  
  16. Dim Dlg As UserDialog
  17. Choice = Dialog(Dlg)
  18. csum = 0
  19. If choice = - 1 Then
  20.   pbc$ = Dlg.zipcode + Dlg.zip4 + Dlg.deliverypoint
  21.   lpbc = Len(pbc$)
  22.   If (lpbc <> 5) And (lpbc <> 9) And (lpbc <> 11) Then
  23.     MsgBox "Incorrect Bar Code Length Must be {5,9,11} it is " + Str$(lpbc), "Postal Bar Code Entry Error"
  24.     choice = 0
  25.   Else
  26.     ercd = 0
  27.     For a = 1 To lpbc
  28.       tc$ = Mid$(pbc$, a, 1)
  29.       If (tc$ >= "0") And (tc$ <= "9") Then
  30.         csum = csum + Val(tc$)
  31.       Else
  32.         ercd = 1
  33.       EndIf
  34.     Next
  35.     If ercd = 1 Then
  36.       MsgBox "Invalid Character (non digit) in Bar Code", "Postal Bar Code Entry Error"
  37.       choice = 0
  38.     End If
  39.   End If
  40. End If
  41. If choice = - 1 Then
  42.   unval$ = Str$(csum)
  43.   undig$ = Right$(unval$, 1)
  44.   If undig$ = "0" Then
  45.     chkdgt$ = "0"
  46.   Else
  47.     chkdgt$ = Right$(Str$(10 - Val(undig$)), 1)
  48.   End If
  49.   pbc$ = "[" + pbc$ + chkdgt$ + "]"
  50.   FormatFont .Points = "12", .Underline = 0, .Color = 0, .Strikethrough = 0, .Superscript = 0, .Subscript = 0, .Hidden = 0, .SmallCaps = 0, .AllCaps = 0, .Spacing = "0 pt", .Position = "0 pt", .Kerning = 0, .KerningMin = "", .Tab = "0", .Font = "Postal Bar Codes 12pt", .Bold = 0, .Italic = 0
  51.   Insert pbc$
  52. End If
  53.  
  54. End Sub
  55.  
  56.